<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/user.css?v={{ layui.setter.version }}" media="all">
</script>
<div class="child-box">
    <div class="layui-card layadmin-header">
        <div class="layui-breadcrumb" lay-filter="breadcrumb">
            <a href="javascript:" lay-href=""><i class="iconfont iconhome"></i>首页</a>
            <a><cite>客户中心</cite></a>
            <a><cite>用户设置</cite></a>
            <div class="layui-card-header-left" title="刷新" zmark-event="layui.manage.render">
                <i class="layui-icon layui-icon-refresh layui-anim" zmark-anim="layui-anim-rotate"></i>
            </div>
        </div>
    </div>
    <div class="layui-card mt20">
        <form class="layui-form form-disabled" method="post" lay-filter="form-user-setting" id="form-user-setting" method="post" onsubmit="return false">
            <div class="layui-card-header">
                <span class="def-fc left-split">用户设置</span>
            </div>
            <div class="layui-card-body">
                <div id="view-user-setting"></div>
            </div>
        </form>
    </div>
</div>
<script type="text/html" id="tpl-user-setting">
<div lay-templateid="tpl-user-setting">
        <div class="layui-row basic-item">
            <div class="layui-col-md6 item-title">
                <span class="info-title">头像</span>
            </div>
            <div class="layui-col-md5 item-value">
                <img src="{{layui.com.isNotEmpty(d.data.head)?d.data.head:'/img/default.jpg'}}" class="head-img"/>
            </div>
            <div class="layui-col-md1 item-btn">
                <button type="button" class="btn-change" id="editHead" title="修改头像">修改</button>
            </div>
        </div>
        <hr>
        <div class="layui-row basic-item">
            <div class="layui-col-md6 item-title">
                <span class="info-title">昵称</span>
            </div>
            <div class="layui-col-md5 item-value">
                <span>{{d.data.name}}</span>
            </div>
            <div class="layui-col-md1 item-btn">
                <button type="button" class="btn-change" title="修改昵称" onclick="layui.userSetting.showEditNickName('{{d.data.name}}')">修改</button>
            </div>
        </div>
        <hr>
        <div class="layui-row basic-item">
            <div class="layui-col-md6 item-title">
                <span class="info-title">性别</span>
            </div>
            <div class="layui-col-md5 item-value">
                <span>{{d.data.genderDesc}}</span>
            </div>
            <div class="layui-col-md1 item-btn">
                <button type="button" class="btn-change" title="修改性别" onclick="layui.userSetting.showEditGender('{{d.data.gender}}')">修改</button>
            </div>
        </div>
        <hr>
        <div class="layui-row basic-item">
            <div class="layui-col-md6 item-title">
                <span class="info-title">邮箱</span>
            </div>
            <div class="layui-col-md5 item-value">
                <span>{{layui.com.isNotEmpty(d.data.mail)?d.data.mail:'您还未设置邮箱'}}</span>
            </div>
            <div class="layui-col-md1 item-btn">
                <button type="button" class="btn-change" title="{{layui.com.isNotEmpty(d.data.mail)?'修改邮箱':'设置邮箱'}}" onclick="layui.userSetting.showEditMail({{layui.com.isNotEmpty(d.data.mail)}})">{{layui.com.isNotEmpty(d.data.mail)?'修改':'设置'}}</button>
            </div>
        </div>
        <hr>
        <div class="layui-row basic-item">
            <div class="layui-col-md6 item-title">
                <span class="info-title">手机</span>
            </div>
            <div class="layui-col-md5 item-value">
                <span>{{d.data.phone.substr(0,3).concat('****').concat(d.data.phone.substr(7,4))}}</span>
            </div>
            <div class="layui-col-md1 item-btn">
                <button type="button" class="btn-change" title="修改手机" zmark-event="layui.userSetting.showEditPhone">修改</button>
            </div>
        </div>
        <hr>
        <div class="layui-row basic-item">
            <div class="layui-col-md6 item-title">
                <span class="info-title">密码</span>
            </div>
            <div class="layui-col-md5 item-value">
                {{d.data.setPassword?'为确保安全，建议您定期修改登录密码':'请设置您的登录密码，您就可以使用注册手机+密码进行登录'}}
            </div>
            <div class="layui-col-md1 item-btn">
                <button type="button" class="btn-change" title="{{d.data.setPassword?'修改密码':'设置密码'}}" onclick="layui.userSetting.showEditPwd({{d.data.setPassword}})" >{{d.data.setPassword?'修改':'设置'}}</button>
            </div>
        </div>
        <hr>
        <div class="layui-row basic-item">
            <div class="layui-col-md6 item-title">
                <span class="info-title">微信</span>
            </div>
            <div class="layui-col-md5 item-value">
                {{d.data.bindWx ? '已绑定':'请绑定微信，便捷微信登录，及时跟踪订单动态'}}
            </div>
            <div class="layui-col-md1 item-btn">
                <button type="button" class="btn-change" title="{{d.data.bindWx ? '换绑微信' : '绑定微信'}}" onclick="layui.userSetting.showBindWx({{d.data.bindWx}})">{{d.data.bindWx ? '换绑' : '绑定'}}</button>
            </div>
        </div>    
</div>
</script>
<script>
    layui.use('userSetting', layui.factory('userSetting'));
</script>